const path = require('path')
const webpack = require('webpack')
const hash = '[hash:7]'
const AssetsPlugin = require('assets-webpack-plugin')

module.exports = {
    devtool: 'source-map',
    entry: {
        permanent: [
            'react',
            'react-dom',
            'isomorphic-fetch',
            'jshashes',
            'react-router-dom',
            'react-lazyload',
            'classnames',
            'antd-mobile',
            'proptypes',
            'react-modal',
            'fundebug-javascript'
        ]
    },
    output: {
        path: path.join(__dirname, 'permanent'),
        filename: `[name].${hash}.min.js`,
        library: '[name]_library',
        sourceMapFilename: "map/[name].js.map",
    },
    plugins: [
        new webpack.DllPlugin({
            path: path.join(__dirname, 'permanent', '[name]-manifest.json'),
            name: '[name]_library'
        }),
        new AssetsPlugin({
            filename: 'bundle-config.json',
            path: './permanent'
        }),
    ]
}
